package online.shenme.day08.genericity;

public class User implements Comparable<User> {
    private String name;
    private String id;
    private int age;

    public User() {
    }

    public User(String name, String id, int age) {
        this.name = name;
        this.id = id;
        this.age = age;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }


    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    @Override
    public String toString() {
        return "User{" +
                "name=" + name +
                ", id=" + id +
                ", age=" + age +
                '}';
    }

    @Override
    public int compareTo(User o) {
        return this.id == null ? 0 : this.id.compareTo(o.getId());
    }
}
